package com.example.chapter;

import android.view.ViewGroup;
import android.widget.TextView;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
import com.example.chapter.util.Utils;

public class ViewBorderActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_view_border);

        TextView vb_code = findViewById(R.id.vb_code);
        ViewGroup.LayoutParams params = vb_code.getLayoutParams();//获取tv_code的布局参数
        params.width = Utils.dip2px(this,300); //修改布局参数中的宽，注意默认px单位，需要把dp数值转成px数值
        vb_code.setLayoutParams(params); //设置vb_code的布局
    }
}